/*Diego Lima de Freitas RA: 317632
 *Yuri Souza Padua RA: 317420
 * 
 * Classe que trata a lista de parâmetros
 */

package AST;

import java.util.ArrayList;

public class ParamList {

    private ArrayList<VarDec> v;

    public ParamList() {
        v = new ArrayList<>();
    }

    public void addElement(VarDec parameter) {
        v.add(parameter);
    }

    public int getSize() {
        return v.size();
    }

    public void genC(PW pw) {

        VarDec p;
        int size = v.size();

        for (int i = 0; i <= size; i++) {
            p = v.get(i);
            pw.out.print(p.getType().getCname() + " " + p.getName());

            if (--size > 0) {
                pw.out.print(", ");
            }
        }
    }

    public ArrayList<VarDec> getParamList() {
        return v;
    }
}
